package com.vise.facedemo.alioss.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.vise.facedemo.R;
import com.vise.facedemo.alioss.bean.Bean;
import com.vise.facedemo.base.Base_Z_Adapter;
import com.vise.facedemo.base.MyApplication;


/**
 * Created by 他的猫 on 2016/12/3.
 * 适配器
 */

public class BanSui_Adapter extends Base_Z_Adapter {
    BanSui_Adapter.Holder holder;
//    ListView listView;
//    private int checked = -1;
//
//    public BanSui_Adapter(ListView listView) {
//        this.listView = listView;
//    }

//    public void setChecked(int checked) {//设定一个选中的标志位，在activity中传入值。
//        this.checked = checked;
//    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        // 查找控件
        if (null == convertView) {
            convertView = LayoutInflater.from(MyApplication.getInstance())
                    .inflate(R.layout.tab_item_1_bansui, null);
            holder = new BanSui_Adapter.Holder();
            holder.neirong = (TextView) convertView
                    .findViewById(R.id.neirong);
            holder.title = (RelativeLayout) convertView
                    .findViewById(R.id.title);
            // 缓存Holder
            convertView.setTag(holder);
        } else {
            holder = (BanSui_Adapter.Holder) convertView.getTag();
        }
        String item = (String) getItem(position);
        holder.neirong.setText(""+item);
//        if (checked == position) {
////            holder.title.setBackground(MyApplication.getInstance().getResources().getDrawable(R.drawable.n1));
//        } else {
////            holder.title.setBackground(MyApplication.getInstance().getResources().getDrawable(R.drawable.n0));
//        }
        return convertView;
    }

    public class Holder {
        TextView neirong;
        RelativeLayout title;

    }
}
